$(function() {
	$('a.AsScreenshot, a.AsPhone').lightBox({
		imageBtnPrev: imgUrl + "/mg/images/lightbox-btn-prev.gif",	
		imageBtnNext: imgUrl + "/mg/images/lightbox-btn-next.gif",
		imageLoading: imgUrl + "/mg/images/lightbox-ico-loading.gif",
		imageBtnClose: imgUrl + "/mg/images/lightbox-btn-close.gif"
	}); // Select all links that contains lightbox in the attribute rel
});

$(document).ready(function(e) {
	jQuery(".box-review, .box-similar").each(function(){
				var self = jQuery(this);
				self.find("> .detail-content").hide();
				var actTab = self.find(" > ul.box-tabs > li.current").prevAll().length;
				self.find("> .detail-content").eq(actTab).show();
				jQuery(this).find(" > ul.box-tabs > li > a").bind("click",function(){
					var elmentId = jQuery(this).attr("rel");
					if(elmentId == null){
						return false;
					}
					var id_html = '#' + elmentId;
					var activeContent = jQuery(id_html);
					if (id_html == '#anotherVersion' ) {
						$(".box-review").css("background","whiteSmoke");
					}else{
						$(".box-review").removeAttr( 'style' );
					}
					self.find("> ul.box-tabs > li.current").removeClass("current");
					jQuery(this).parent().addClass("current");
					self.find("> .detail-content").hide();
					activeContent.show();
					return false;
				});
	});
		
	jQuery(".jcarousel-screenshot-product").jcarousel({
		visible: 4,
		buttonNextHTML: ".next",
		buttonPrevHTML: ".prev"	
	});
	
	var opt = {
		handle: '#etoggle',
		dir: imgUrl + '/mg/images/emotions/',
		label_on: 'On Emotions',
		label_off: 'Off Emotions',
		style: 'background: #eee',
		css: 'class2'
	}
	$('.emotion').emotions2(opt);
});

function setHomepage(){
	if (document.all){
        document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(siteUrl);
    }
    else if (window.sidebar)
    {
		if(window.netscape)
		{
			try
			{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}
			catch(e)
			{
				alert("This action was aviod by your browser，if you want to enable，please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
			}
		}
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',siteUrl);
	}
}

